<?php
global $meta;

$meta = array(
	"description"=>"",
	"keywords"=>array(),
	"author"=>"",
	"charset"=>"utf-8",
	"content-type"=>"text/html"
	);

function meta_add_keywords($keywords) {
	if (!is_array($keywords)) $keywords = explode(",", $keywords);
	global $meta;
	foreach ($keywords as $k) {
		$k = slug($k);
		if (!in_array($k, $meta['keywords'])) $meta['keywords'][] = $k;
	}
}

function meta_set_author($name) {
	global $meta;
	$meta['author'] = $name;
}

function meta_set_description($desc) {
	global $meta;
	$meta['description'] = $desc;
}

function meta_register() {
	global $meta;
	$metacode = "<meta name=\"description\" content=\"{$meta['description']}\" />\n<meta name=\"keywords\" content=\"".implode(", ", $meta['keywords'])."\" />\n<meta name=\"author\" content=\"{$meta['author']}\" />\n<meta http-equiv=\"Content-Type\" content=\"{$meta['content-type']};charset={$meta['charset']}\" />";
	Page::Set("page.metacode", $metacode);
}


?>